<template>
  <div class="flex align-center block-title">
    <div class="inline-flex align-center block-title__left">
      <span v-if="showFlag" class="margin-right-10 block-title__flag" :style="{backgroundColor: themeColor}"></span>
      <span class="block-title__text">{{ title }}</span>
    </div>
    <slot name="right"></slot>
  </div>
</template>

<script>
export default {
  name: 'block-title',
  props: {
    title: String,
    showFlag: {
      type: Boolean,
      default: true
    }
  },
  computed: {
    themeColor () {
      return this.$store.state.user.theme
    }
  }
}
</script>

<style lang="scss" scoped>
  @import "@/assets/style/variable.scss";

  .block-title {
    &__flag {
      width: .3em;
      height: 1em;
      border-radius: 0.1em;
    }
  }
</style>
